package com.zqh.myfmmall.fallback;

import com.zqh.myfmmall.clients.CategoryQueryClient;
import com.zqh.myfmmall.result.Result;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-03-15 21:54
 */
@Slf4j
public class CategoryQueryClientFallback implements FallbackFactory<CategoryQueryClient>{
    @Override
    public CategoryQueryClient create(Throwable cause) {
        log.info("调用查询商品分类服务异常："+cause);
        System.out.println(cause);
        return new CategoryQueryClient(){
            @Override
            public Result retrieveByParentId(String parentId) {
                return Result.internalServerError();
            }

            @Override
            public Result retrieveFirstLevalCategoryVos() {
                return Result.internalServerError();
            }

            @Override
            public Result retrieveAllVo() {
                return Result.internalServerError();
            }
        };
    }
}
